I'd like to propose new options for working with sound. Since PB switched to the miniaudio-lib, it might be possible

What, if we could edit audio like images? I mean, do something like (with a better named command than StartSounding():
Code: Select all
define mySound = CreateSound(#pb_any, 2000, 16, 2, 48000) ; 2000 msecs, 16 Bits, Stereo, 48000 Hz
if StartSounding(SoundOutput(mySound))
debug SoundBuffer() ; directly access sound-data
debug SoundBufferBitFormat() ; display bits per sample
debug SoundBufferPitch() ; display size of one sample
debug SoundBufferChannels() ; 2 = stereo
debug SoundBufferRate() ; e.g. 48000
StopSounding()
endif
Expose more MiniAudio-Functions
Audio-Filter - please try, comment, optimise, notify bugs
pl_mpeg.h and decoding question
Posting the structure of a PB-sound would be a great start.
Addition (2025-02-08) (after some thoughts and the comment by infratec):
Possible functions:
Code: Select all
define mySound = CreateSound(#pb_any, 2000, 16, 2, 48000) ; creates an empty buffer, 2000 msecs, 16 Bits, Stereo, 48000 Hz
ResizeSound(SoundID, newlength_in_msecs) ; make changing bits, channels, samplerate also possible?
SaveSound(SoundID, "export.wav", #pb_soundformat_wav) ; save as .wav as minimum, .ogg, etc. possible?
StartRingBuffer(SoundID) ; prepare a ring buffer
SetRingbufferCallback(@FilterCallback()) ; is called, when a part of the ring buffer has finished playing, so you can fill it again
CustomSoundFilterCallback(@SoundFilterCallback()) ; like CustomFilterCallback