0
0

Hello Brett,

I looked many post in this forum that talk about how to show a spectrum while recording a sound. The solutions seems to be to play the sound silently and get the spectrum… But I really don’t know how to acheive that… I’m using FMOD_System_RecordStart to record from the mic to record on the disk. What functions I should use please in VB ?

Also, is it possible to have the recorded time in milliseconds please when recording to the disk ?

Thank you very much

  • You must to post comments
0
0

Hi,

What is the substitute for the code below in c#?

[code:36u2pstk] result = FMOD_Channel_SetChannelGroup(Channel, Channelgroup)
result = FMOD_System_GetDSPHead(System, Dsp)
result = FMOD_DSP_SetInputMix(Dsp, 0, 0)[/code:36u2pstk]

because i cannot find DSP.setInputMix…

  • You must to post comments
0
0

DSP::setInputMix is no longer part of the API, this thread is over 4 years old. You could try using DSP::getInput to get all the inputs, then call DSPConnection::setMix on all of those inputs. If you’re just trying to mute the system there are easier ways.

  • You must to post comments
0
0

fmod doesnt record to disk? If you are writing pcm data to disk, then simply count the number of samples you write to the disk. That is your time.

The dsppluginviewer shows how to display spectrum while recording.

  • You must to post comments
0
0

Thanks for your help but unfortunately dosen’t work

my problem is, when I call

[code:28aus9zy] channel.getDSPHead(ref dsp);
dsp.getInput(0, ref dsp, ref dspconnection);
dspconnection.setMix(0.0f);
system.getWaveData(WAVEDATA, 512, 0);[/code:28aus9zy]
it mutes all input, but when I open the recorded mp3 I hear the recorded sound.
1.
I only want to see the recording level during record, but now I also see it in a progressbar and hear it from the speaker, thats why there is a big echo.

My code is:
[code:28aus9zy]
private void timer_Tick(object sender, System.EventArgs e)
{
...
channel.getDSPHead(ref dsp);
dsp.getInput(0, ref dsp, ref dspconnection);
dspconnection.setMix(0.0f);
channelgroup.getWaveData(WAVEDATA, 512, 0);
...
}

    private void Form1_Load(object sender, EventArgs e)
   {
          ...
        result = FMOD.Factory.System_Create(ref system);
        result = system.getVersion(ref version);
        result = system.setOutput(FMOD.OUTPUTTYPE.DSOUND);  //beállítjuk a DirectSound-ot kimenetnek
        result = system.init(32, FMOD.INITFLAGS.NORMAL, (IntPtr)null);
        result = system.createSound((string)null, (FMOD.MODE.LOOP_NORMAL | FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.OPENUSER), ref exinfo, ref sound); //FMOD.MODE.LOOP_NORMAL | 

        dspdesc.name = dspname.ToCharArray(0, 32);
        dspdesc.channels = 0;
        dspdesc.read = dspreadcallback;

        result = system.createDSP(ref dspdesc, ref dsp);
        result = system.addDSP(dsp, ref dspconnection);
        result = dsp.setActive(true);
        result = dsp.setBypass(true);

public void startRecording()
    {
            system.createSound((string)null, (FMOD.MODE.LOOP_NORMAL | FMOD.MODE.SOFTWARE | FMOD.MODE._2D | FMOD.MODE.OPENUSER), ref exinfo, ref sound);
            result = system.recordStart(selected, sound, true);
            ERRCHECK(result);

            system.getOutput(ref output);
            if (output != FMOD.OUTPUTTYPE.ASIO)
            {
                Thread.Sleep(100);
            }

            system.playSound(FMOD.CHANNELINDEX.FREE, sound, false, ref channel);

    ...

}

[/code:28aus9zy]

Ps.: btw how can I just play the sound and put it in a channelgroup as mentioned above by brett?

Thank you for help…

  • You must to post comments
0
0

Hello,

I have checked the sample and I have added the line :

[code:kgtoyf6e] result = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, Sound, False, Channel)[/code:kgtoyf6e]

The spectrum is working now when I’m recording but I have two problems now:

1- I can hear the sound from the speaker while I’m recording. How can I disable it ?

2- The spectrum is shown just for 2 seconds (the length of the recording buffer). How can I make the spectrum to be shown for all the recording ?

For the milliseconds, thank you very much. Here is the code for others:
[code:kgtoyf6e] lngLength = Datalength / (g_lngRate / 1000) / (2 * g_intChannels)
frmAudioRecorder.lblStatus = format(CInt(lngLength / 1000 / 60), "00") & ":" & format(CInt(lngLength / 1000 Mod 60), "00") & ":" & format(CInt(lngLength / 10 Mod 100), "00")[/code:kgtoyf6e]

  • You must to post comments
0
0

Right, I’ve set dsp.setByPass to false, and dspdesc.channel to 1 and

this code was moved from timer1_Tick to startRecording()
[code:1tj6b56d]channel.getDSPHead(ref dsp);
dsp.getInput(0, ref dsp, ref dspconnection);
dspconnection.setMix(1.0f); [/code:1tj6b56d]

everything is allright, there are not any echo, speakers are mute, progressbar is showing the sound level only during recording, BUT: if I set dspconnection.setMix([b:1tj6b56d]0.0f[/b:1tj6b56d]); it won’t show anything(recording to a file still good), if I leave it in dspconnection.setMix([b:1tj6b56d]1.0f[/b:1tj6b56d]); or delete this line it works as it should be

is it normal behavoiur or I’ve made a mistake somewhere in the code, because I’d expect that 0.0f would mute the echo, and 1.0f would reveal it, not?

  • You must to post comments
0
0

[quote="yota_1998":hnwu6emz]Hello,

I have checked the sample and I have added the line :

[code:hnwu6emz] result = FMOD_System_PlaySound(System, FMOD_CHANNEL_FREE, Sound, False, Channel)[/code:hnwu6emz]

The spectrum is working now when I’m recording but I have two problems now:

1- I can hear the sound from the speaker while I’m recording. How can I disable it ?
[/quote:hnwu6emz]

You will have to mute the output before it gets to the soundcard.

Try something like
system->getDSPHead(&dsphead);
dsphead->setInputMix(0, 0);

That may mute the sound before it reaches the system getspectrum processor, so if it does you could just play the sound and put it in a channelgroup, and call ChannelGroup::getSpectrum instead which should put it far enough away from the System::getSpectrum processor so that the getspectrum isnt muted as well (see the layout of the DSP network in the DSP network tutorial)

[quote:hnwu6emz]
2- The spectrum is shown just for 2 seconds (the length of the recording buffer). How can I make the spectrum to be shown for all the recording ?
[/quote:hnwu6emz]

The dsppluginviewer uses a looping sound, not a one shot sound. you need to add FMOD_LOOPMODE_NORMAL to the record sound and make sure loop = true for the record command as well.

  • You must to post comments
0
0

Thank you Brett for your quick reply :)

The FMOD_LOOPMODE_NORMAL resolves my issue. Thanks !

After I’ve created a ChannelGroup and set the System DSP Head to Mute when the recording is started;

[code:2ih7bpfl] result = FMOD_Channel_SetChannelGroup(Channel, Channelgroup)
result = FMOD_System_GetDSPHead(System, Dsp)
result = FMOD_DSP_SetInputMix(Dsp, 0, 0)[/code:2ih7bpfl]

and in the RecordingCallback, I now get the Spectrum and the WavData (for the Oscilloscope) from the ChannelGroup instead of the System.

It works well, I don’t hear any sound now but there is an echo (that I cannot hear but I can see in the Spectrum) when I’m recording now. If I make a sound while recording, the spectrum output the sound (graphically), but after about 1 second, I can see the same output in the spectrum…

For the Oscilloscope, the thing is little different; I can see the output Oscilloscope just 1 time but 1 second too late…

Can you help me please ?

Thank you again

  • You must to post comments
0
0

you’re probably not allowing the playcursor to wait for the recorded data to be recorded before you play it. Putting a sleep of 100ms after record start and before the playsound will probably solve that.
You should test it by not muting the output and seeing if your playback comes back relatively quickly. There will be a little bit of latency it is unavoidable, unless you use ASIO which means extremely low latency.

  • You must to post comments
0
0

Grrrrrrrrrrrreat ! It’s working very nice !!!

One last question: is it possible to control the input sound when recording (recording volume) ? If yes, how ? I looked in the documentation and I found something with the Event, but I think they are not available in VB….

Thank you again

  • You must to post comments
0
0

hi, there is no volume control on the input stream.

  • You must to post comments
0
0

Please send me your source code to I studie.

I need developer an software to people test MIC volume in record.

  • You must to post comments
0
0

Please read the thread before posting in it, there is an example called dsppluginviewer which does display/processing of realtime mic input.

  • You must to post comments
Showing 13 results
Your Answer

Please first to submit.