Page 2 of 2
Re: Generate a tone .pb example ?
Posted: Fri Oct 28, 2022 3:39 pm
by Olli
AZJIO, thanks for the back info : I am coding on the 2016 version !!!
(44.1 KHz 16 bits 1 channel. Short note, I prefer let our friend
infratec manage high-end : 44.1 KHz 24 bits 2 channels or more ! Maybe ADPCM also... "deutsche Qualität" !)
fixed for LTS version :
Code: Select all
structure wav
array w.w(21)
endStructure
initSound()
*wav.wav = allocateMemory(sizeOf(wav) )
initializeStructure(*wav, wav)
base64decoder("UklGRgAAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQ", @*wav\w(0), 40)
with *wav
wMax = 62800
reDim \w(wMax + 22)
size = (wMax + 23) * 2
PokeL(@\w(2), size - 8)
PokeL(@\w(20), size - 44)
ampli.d = 800
for i = 0 to wMax
\w(i + 22) = cos(i / (7 - sin(t.d) ) ) * ampli
ampli * 0.999
t + 0.00015
next
snd = catchSound(#pb_any, @\w(0) )
repeat
playSound(snd, #pb_sound_multiChannel)
delay(400)
until inputRequester("", "Just press enter to play", "")
endWith
Re: Generate a tone .pb example ?
Posted: Sun Mar 12, 2023 11:32 am
by firace
Olli wrote: Fri Oct 28, 2022 3:39 pm
AZJIO, thanks for the back info : I am coding on the 2016 version !!!
(44.1 KHz 16 bits 1 channel. Short note, I prefer let our friend
infratec manage high-end : 44.1 KHz 24 bits 2 channels or more ! Maybe ADPCM also... "deutsche Qualität" !)
fixed for LTS version :
Code: Select all
structure wav
array w.w(21)
endStructure
initSound()
*wav.wav = allocateMemory(sizeOf(wav) )
initializeStructure(*wav, wav)
base64decoder("UklGRgAAAABXQVZFZm10IBAAAAABAAEARKwAAIhYAQACABAAZGF0YQ", @*wav\w(0), 40)
with *wav
wMax = 62800
reDim \w(wMax + 22)
size = (wMax + 23) * 2
PokeL(@\w(2), size - 8)
PokeL(@\w(20), size - 44)
ampli.d = 800
for i = 0 to wMax
\w(i + 22) = cos(i / (7 - sin(t.d) ) ) * ampli
ampli * 0.999
t + 0.00015
next
snd = catchSound(#pb_any, @\w(0) )
repeat
playSound(snd, #pb_sound_multiChannel)
delay(400)
until inputRequester("", "Just press enter to play", "")
endWith
Nice code!
Is it possible to customize the tone frequency, duration and/or waveform?
Re: Generate a tone .pb example ?
Posted: Sun Oct 06, 2024 6:08 am
by Olli
Hello firace,
if I did not answer to your question, it is because I do not see what does it prevent us to modify the frequency, the duration and the waveform.
However, what we can listen to, is a liquid drop. If you change the frequency, the duration or the waveform, I doubt you will listen a liquid drop...