QTM and QTM_PlayRawSample
Peter Howkins (211) 236 posts |
Hiya, First Question: I’m trying to figure out the sound format I need to convert the data too so QTM can play it, the documentation suggests “8-bit logarithmic format” but !SoundCon offers many more options than that for RAW sample data Stereo/Mono? I’ve assumed 8-bit, little endian. I’ve tried a few different formats without success 8-bit u-law mono 44100Hz These all playback with enough distortion that I can barely discern the original sound. Second Question: The R5 param for QTM_PlayRawSample is the note to play it back with (I presume as in a tracker, samples are pitch bent up or down to play the specific notes), what would be the value for ‘playback without bending the pitch’, the natural speed of the sample? (Some value in the middle?) |
jim lesurf (2082) 1438 posts |
Afraid I can’t help as I haven’t ever been interested in 8-bit sound. However it may help others advise if you say what hardware and OS version you’re using. Jim |
Rick Murray (539) 13850 posts |
Doesn’t QTM play Amiga IFF? This is a billion year old memory, so maybe wrong. .. |
Peter Howkins (211) 236 posts |
The hardware is a Pi B+ running 5.21. QTM itself will play back many tracker formats (and the many formats of the samples inside them), but QTM_PlayRawSample is likely to need a specific type, given you just give a pointer to the data in memory and a length (assuming no autodetection). From the Technical Docs
|
Peter Howkins (211) 236 posts |
“The sample should be in 8-bit logarithmic format” This is what I’m struggling with, that’s not enough information. Alternatively SoundCon could be converting things slightly incorrectly. Are there any other RISC OS Wav file to RAW convertors? “See file ‘NoteFormat’ for more information on the 6-octave 72 note format.” This has had enough information in for me to determine that my samples recorded at 44100Hz should be played back at note F-3 (value of 80 is closest at 44336Hz). |
Jon Abbott (1421) 2651 posts |
It expects the sample to be in standard VIDC 8-bit audio format (mu-law). Strictly speaking it’s not a pure logarithm as the chords are logarithmic but the offset within the chord is linear, where you’re possibly going wrong is with the sign which is in bit 0: bit Value The correct way to do the encoding is via the lookup table provided by the Channel Handler looked up via Sound_Configure MOV R0, #0 The table is 8Kb in length, so you should scale your linear value accordingly via LSR #x If you’re converting the sample outside of fill code, you could simply call Sound_SoundLog with a 32bit signed sample and it will return the mu-law equivalent. |
Peter Howkins (211) 236 posts |
Replying to my own question incase anyone searches for this in future. Ta Jon, with that information I was able to use !SoundCon to output 8bit, mono, ‘vidc’ unsigned format raw sound (at 44100Hz) At that frequency the correct code is DIM somespace% 100000 There is an issue on the Pi B+ with slightly distorted sound, but this is due to the presence of the disable_audio_dither flag in config.txt, remove that from config.txt and the playback is fine, but there is the constant background hiss reported in the other threads. |