Hi!
This question is for people who have implemented mod players,
midi players and other audio/music stuff. What is the most # of
channels you have gotten playing (active) at once on PSP? And
are you using floating point or fixed. And are you using bilinear,
cubic, sinc, or non-interpolated, etc? Synthesis method.
Also, are you using the media engine, or not, C, assembly, optimized C, optimized assembly, etc.
Using fixed-point, non-optimized C, with no cop, bilinear interp, I've
gotten 24 mono voices wavetable playback to work. But 24 voices
takes a lot of CPU away from the user. 18 voices has almost no
interference.
# of Simultaneous Audio Voices
Re: # of Simultaneous Audio Voices
Why hasn't anyone replied to this? Is this posting a retorical question? I mean,
is that the answer to the question? That there are up to 24 voices on the PSP,
but you should try keeping it down to 18. Are there only mono-channels, so
that you can decide on your own if you want to distribute them in a 7.1 system,
or maybe just a stereo system? I've been searching for a spec. on the PSP's
audio, but I can't find any usable information.
All I've found this far is that the audio is played back at 44.1kHz. I found this
information through a pdf by Groepaz/Hitmen. It's 154 pages, and the audio-section
looks like this:
but still, how many channels (voices that is) can I use, are they in stereo or
mono? Can I use ogg-audio and load them as wav into ram? Or should I
use mp3? Should the audio be played from host? Should the audio be wav
on disk?
I would be very greatful for any help. I hope I haven't reposted, I really
searched this forum, but I can't find anything..
is that the answer to the question? That there are up to 24 voices on the PSP,
but you should try keeping it down to 18. Are there only mono-channels, so
that you can decide on your own if you want to distribute them in a 7.1 system,
or maybe just a stereo system? I've been searching for a spec. on the PSP's
audio, but I can't find any usable information.
All I've found this far is that the audio is played back at 44.1kHz. I found this
information through a pdf by Groepaz/Hitmen. It's 154 pages, and the audio-section
looks like this:
And that's it... Some posts imply that you can use SDL_mixer with the PSP,Audio-section wrote: 12 Audio Processing
12.1 Overview
44100 Hz Sample Frequency
but still, how many channels (voices that is) can I use, are they in stereo or
mono? Can I use ogg-audio and load them as wav into ram? Or should I
use mp3? Should the audio be played from host? Should the audio be wav
on disk?
I would be very greatful for any help. I hope I haven't reposted, I really
searched this forum, but I can't find anything..
-
- Posts: 75
- Joined: Mon Sep 19, 2005 5:41 am
I needed to playback audio and was against using SDL or other opensource packages, and since I wasn't able to find a turnkey solution I wrote my own audio player code.
It is for games and allows playback of one stereo .WAV file that is streamed from memory/disc, while at the same time playing several smaller one-shot sound effects that are memory resident, and at the same time streaming in from memory/disc playing medium length Voice-Over one-shots.
It's the kind of thing you wound want for a video game not for a general purpose audio player.
I use the 8 channels that the system has and do not mix audio on a given channel.
It does have some overhead, but I have not gotten around to optimizing it yet and so I think it can be done with minimal overhead once optimized.
Hope this helps...
It is for games and allows playback of one stereo .WAV file that is streamed from memory/disc, while at the same time playing several smaller one-shot sound effects that are memory resident, and at the same time streaming in from memory/disc playing medium length Voice-Over one-shots.
It's the kind of thing you wound want for a video game not for a general purpose audio player.
I use the 8 channels that the system has and do not mix audio on a given channel.
It does have some overhead, but I have not gotten around to optimizing it yet and so I think it can be done with minimal overhead once optimized.
Hope this helps...
Ok, this means that I now know that the playback frequency is 44.1k, and atstarman2049 wrote:I use the 8 channels that the system has
8 channels. Are these 8 mono-channels, giving me 8 voices, or are they
stereo, giving me a total of 16 voices?
And I'm asking this cause I'm trying to create a videogame, not a media
player. So this information was really helpful. Thanks.
I have been a bit puzzled over the memory size. I was kinda guessing there
would be a way of streaming wav from disk. That, or being able to play midi-files.
Are you sharing? ;)starman2049 wrote:I wrote my own audio player code.
-
- Posts: 75
- Joined: Mon Sep 19, 2005 5:41 am
If you look in pspaudio.h you will see the def:
#define PSP_AUDIO_CHANNEL_MAX 8
I assume that this is the machine, and not the SDK interface to the hardware.
You can support any frequency by adjusting the stride and your buffer filling routines. I use 22kHz, 16 bit mono on the argument that the fidelity of the two tiny speakers in the PSP is so low that you can't really tell the difference anyway.
1) On init allocate a fixed HW channel for music playback via sceAudioChReserve() so its always there (two for stereo if you want)
2) When you want to play music, start a new thread to handle file IO and buffer filling and sit in a tight loop doing:
(READ A SAMPLE INTO A SAMPLE BUFFER)
sceAudioOutputBlocking() to output sample
Sound effects and VO are similiar, except I allocate a channel at request time. it would be possible this way to run out of channels, but since I am doing only mono it has not yet happened, and to be honest if you have 8 channels all rocking I doubt anybody know if a sfx was not playing.
I hate threads and tried to conceive a way to do this w/o threads and I can tell you there is not a way - especialy if you are streaming.
People talk about double and triple buffering to get rid of clicks, but I have never heard any so I must be doing something different.
I have a 3 SKU game on display at GDC and another app at MIX so I can't take the time right now to seperate my audio code and put it up - sorry...
#define PSP_AUDIO_CHANNEL_MAX 8
I assume that this is the machine, and not the SDK interface to the hardware.
You can support any frequency by adjusting the stride and your buffer filling routines. I use 22kHz, 16 bit mono on the argument that the fidelity of the two tiny speakers in the PSP is so low that you can't really tell the difference anyway.
1) On init allocate a fixed HW channel for music playback via sceAudioChReserve() so its always there (two for stereo if you want)
2) When you want to play music, start a new thread to handle file IO and buffer filling and sit in a tight loop doing:
(READ A SAMPLE INTO A SAMPLE BUFFER)
sceAudioOutputBlocking() to output sample
Sound effects and VO are similiar, except I allocate a channel at request time. it would be possible this way to run out of channels, but since I am doing only mono it has not yet happened, and to be honest if you have 8 channels all rocking I doubt anybody know if a sfx was not playing.
I hate threads and tried to conceive a way to do this w/o threads and I can tell you there is not a way - especialy if you are streaming.
People talk about double and triple buffering to get rid of clicks, but I have never heard any so I must be doing something different.
I have a 3 SKU game on display at GDC and another app at MIX so I can't take the time right now to seperate my audio code and put it up - sorry...
The PSP Rhythm audio sample engine works on one audio channel. It has a basic mixer that mixes samples into the audio callback. it was loosely based off of the drumpiler code off of source forge.
http://drumpiler.sourceforge.net/.
My samples have a struct with a variable that tells the mixer if a sound is playing then mix it in. If not it resets the sample pointer to the begining and doesn't mix it in. That way I can play at least 32 samples at a time. I'm not sure how much it taxes the processor because my graphics are very minimal.
There was a wavloader thread in these forums that works for playing samples and it is pretty solid. I tried the sceAudioOutputBlocking but it had that clicking problem (it could have been the way I was implementing it). If you want a simple audio playback method I would search for that wavloader code.
http://drumpiler.sourceforge.net/.
My samples have a struct with a variable that tells the mixer if a sound is playing then mix it in. If not it resets the sample pointer to the begining and doesn't mix it in. That way I can play at least 32 samples at a time. I'm not sure how much it taxes the processor because my graphics are very minimal.
There was a wavloader thread in these forums that works for playing samples and it is pretty solid. I tried the sceAudioOutputBlocking but it had that clicking problem (it could have been the way I was implementing it). If you want a simple audio playback method I would search for that wavloader code.