maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Recording problem using different applications. (https://talk.maemo.org/showthread.php?t=99444)

NotMicro 2017-06-05 12:01

Recording problem using different applications.
 
I am a great fan of recording live music. I was trying to use for this my N900, but I am very disappointed with the results. First of all - almost every application designed for recording ( I mean orecchiette, voicenote, recorder, mydicto etc.) use pcm (and in effect wav files) which consumes a lot of space in memory. When I was trying to record music with orccchiette and AAC codec, I got "flowing" sound with unacceptable quality (48 kHz, 2 channel 128 kbit/s). The best sound records stock camera application when it is in video recording mode. Audio is then in mp4a format and sounds really great (as for this kind of device). Can anybody tell me how to record compressed sound with good quality.

pichlo 2017-06-05 12:23

Re: Recording problem using different applications.
 
Quote:

Originally Posted by NotMicro (Post 1528825)
I got "flowing" sound

What is "flowing" sound?

Quote:

with unacceptable quality (48 kHz, 2 channel 128 kbit/s).
What is unacceptable about that?

Quote:

Can anybody tell me how to record compressed sound with good quality.
I would (and do) record as WAV and post-process with ffmpeg. An hour of WAV recording is just a few hundred MB, not a big deal if you do not keep it permanently.

Code:

ffmpeg -i file.wav file.mp3
(If running on the phone, prepare for a loooong run ;))

mosen 2017-06-05 17:18

Re: Recording problem using different applications.
 
I guess he means the recording is unacceptable despite using decent freq range and bitrate?

+1 for raw recording.
With n900 i used "recorder" on phone and later at home direct ffmpeg source path on my laptop to n900 sftp mount so i do not need to first copy and then encode large recodings.

From my experience it takes around 1.5 times original play time to encode raw to aac on n900. Which could also be the cause for problems with live encoding i guess?

ontime 2017-06-05 17:30

Re: Recording problem using different applications.
 
- if you want rec from headset mic, in xterm:
Code:

gst-launch-0.10 -e pulsesrc device=source.hw0 ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a
amixer -qc0 set "Input Select" ADC

this set gain for it (0-127), here is 60
Code:

amixer -qc0 set PGA 60
- if you want rec from builded in mic, in xterm:
Code:

amixer -qc0 set "Input Select" "Digital Mic"
gst-launch-0.10 -e pulsesrc device=source.record ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a

make sure that capture is on:
Code:

amixer -q cset name='Capture Switch' on
amixer -qc0 cset name='PGA Capture Switch' on


NotMicro 2017-06-12 11:43

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1528840)
- if you want rec from headset mic, in xterm:
Code:

gst-launch-0.10 -e pulsesrc device=source.hw0 ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a
amixer -qc0 set "Input Select" ADC

this set gain for it (0-127), here is 60
Code:

amixer -qc0 set PGA 60
- if you want rec from builded in mic, in xterm:
Code:

amixer -qc0 set "Input Select" "Digital Mic"
gst-launch-0.10 -e pulsesrc device=source.record ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a

make sure that capture is on:
Code:

amixer -q cset name='Capture Switch' on
amixer -qc0 cset name='PGA Capture Switch' on




Wow! Just great ! I see that you are a real professional. Thank you for this complete answer. I will try this method as soon as possible.

I have only one more question: is there any chance to record stereo sound using, for example, usb microphone. Or maybe there is a way to use standard external stereo mic connected to minijack in N900?

ontime 2017-06-13 08:18

Re: Recording problem using different applications.
 
for usb stereo mic, you need:
- driver for it which will be working on n900
- h-e-n - it's in repository
- OTG cable
- some app that can rec from your mic (gstreamer, audacity, etc)

it's simple when you have all that components

second solution but not perfect:
- use build in mic as left channel
- use headset mic as right channel
- mix both into audio file (maybe gsteamer can do that)

minijack in n900 has only one input, so only mono (can be multiplexed, but that need specific mics and specific app on n900, not worth of thinking)

I use nokia e52 for record stereo sound. It has build in two mics.

badpixel 2017-06-13 09:39

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1529116)
for usb stereo mic, you need:
- driver for it which will be working on n900
- h-e-n - it's in repository
- OTG cable
- some app that can rec from your mic (gstreamer, audacity, etc)

it's simple when you have all that components

second solution but not perfect:
- use build in mic as left channel
- use headset mic as right channel
- mix both into audio file (maybe gsteamer can do that)

minijack in n900 has only one input, so only mono (can be multiplexed, but that need specific mics and specific app on n900, not worth of thinking)

I use nokia e52 for record stereo sound. It has build in two mics.

Or even better use Nokia n9. It.by default records nice videos with stereo sound. It also suppports stereo line-in(not sure about n900, its video cable is compatible, maybe stereo too). You can use similar gstreamer hacks, but there are already good apps for stereo/mono recording.eith input selection.

ontime 2017-06-13 11:55

Re: Recording problem using different applications.
 
third option:
- stereo bluetooth mic
- n900 should recognise it as stereo? (fm radio turns on bluetooth and it's stereo)

fourth:
- stereo FM mic
- n900 has stereo FM receiver

Quote:

Or even better use Nokia n9. It.by default records nice videos with stereo sound. It also suppports stereo line-in(not sure about n900, its video cable is compatible, maybe stereo too).
in n900 alsamixer shows jack function:
- headphone
- headset
- mic
- eci headset (if headset has many buttons, like play, vol+, vol- etc. then it's probably ECI accessory)
- tv out
- off
so it seems no line-in, neo900 has

Quote:

You can use similar gstreamer hacks, but there are already good apps for stereo/mono recording.eith input
yes, gstreamer is for people who likes look into interior. btw, do you know some light & fast app for cut m4a, mp4 without decoding/encoding?

NotMicro 2017-06-23 12:53

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1528840)
- if you want rec from headset mic, in xterm:
Code:

gst-launch-0.10 -e pulsesrc device=source.hw0 ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a
amixer -qc0 set "Input Select" ADC

this set gain for it (0-127), here is 60
Code:

amixer -qc0 set PGA 60
- if you want rec from builded in mic, in xterm:
Code:

amixer -qc0 set "Input Select" "Digital Mic"
gst-launch-0.10 -e pulsesrc device=source.record ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a

make sure that capture is on:
Code:

amixer -q cset name='Capture Switch' on
amixer -qc0 cset name='PGA Capture Switch' on



I am very sorry for long delay in my answers. Thank you very much once again for your posts. I have though more questions:

- how to stop recording
- when I use commands described in your post I get file "audio.m4a" but it is not playable (even no time of recording is seen in any player). It has size but it seems that there is nothing in it.

ontime 2017-06-23 13:41

Re: Recording problem using different applications.
 
ah, right
for manual stop, press Ctrl+c in the same terminal
or
send SIGINT (kill -2 $PID) to gstreamer:
Code:

kill -2 `pidof gst-launch-0.10`

NotMicro 2017-06-26 10:53

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1529532)
ah, right
for manual stop, press Ctrl+c in the same terminal
or
send SIGINT (kill -2 $PID) to gstreamer:
Code:

kill -2 `pidof gst-launch-0.10`

Thank you for this. And what do you think about my problems with playing recorded file audio.m4a.

ontime 2017-06-26 13:47

Re: Recording problem using different applications.
 
wrong stopped or crash - lack metadata in file
if you have mplayer:
Code:

mplayer -quiet -slave -frames 0 -vo null -ao null -identify audio.m4a

NotMicro 2017-06-27 13:46

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1529691)
wrong stopped or crash - lack metadata in file
if you have mplayer:
Code:

mplayer -quiet -slave -frames 0 -vo null -ao null -identify audio.m4a


Thank you once again for this outstanding solutions. I am really very very impressed. You are a real audio professsional !! Problem solved thanks to your advice how to stop recording. After this, file is correct and fully playable.
If you would be so kind please answer for some questions, what may have been useful for many users.

1. If I am recording quiet sounds some clicking is heard in the background. No matter if this is wav or m4a audio and which application is used for recording. This problem was also described in this thread:

http://talk.maemo.org/showthread.php?t=54860

2. When I am recording sound using, for example, recorder app high volume sounds are almost always oversteered. In VoiceNote or when recording video with standard camerra application are not.
Do you know why is it so?

3. Is there any difference between recording "m4a" sound with the standard camera application and this method you have proposed? I mean set of commands.

4. What is the meaning of output-format parameter. What could have happen when this is different from 0.

ontime 2017-06-27 16:46

Re: Recording problem using different applications.
 
Quote:

1. If I am recording quiet sounds some clicking is heard in the background. No matter if this is wav or m4a audio and which application is used for recording. This problem was also described in this thread:

http://talk.maemo.org/showthread.php?t=54860
put here sample with this clicking noise

Quote:

2. When I am recording sound using, for example, recorder app high volume sounds are almost always oversteered. In VoiceNote or when recording video with standard camerra application are not.
Do you know why is it so?
try this in xterm
Code:

amixer -qc0 set PGA 0
and
Code:

alsamixer -c0
When you click Tab, you'll see all capture settings. You can use arrow keys to adjust it.
or
You can use different audio source instead of 'source.hw0':

source.voice (hardware dsp)
source.record

Code:

gst-launch-0.10 -e pulsesrc device=source.record ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a
Quote:

3. Is there any difference between recording "m4a" sound with the standard camera application and this method you have proposed? I mean set of commands.
camera application vs gstreamer:
- audio bitrate - 128kbps vs you can choose
- audio rate - 48000Hz vs 44100Hz
- audio source - source.record vs you can choose (ad 2.)

- both has one channel
- the same codec - nokiaaacenc
- the same container - hantromp4mux

Quote:

4. What is the meaning of output-format parameter. What could have happen when this is different from 0.
Code:

gst-inspect-0.10 nokiaaacenc
(0): RAW - AAC Raw format (it needs container)
(1): ADTS - Audio Data Transport Stream format (can be streams directly into playable aac file)
(2): ADIF - Audio Data Interchange Format

NotMicro 2017-07-03 13:14

Re: Recording problem using different applications.
 
2 Attachment(s)
Quote:

Originally Posted by ontime (Post 1529753)
put here sample with this clicking noise



try this in xterm
Code:

amixer -qc0 set PGA 0
and
Code:

alsamixer -c0
When you click Tab, you'll see all capture settings. You can use arrow keys to adjust it.
or
You can use different audio source instead of 'source.hw0':

source.voice (hardware dsp)
source.record

Code:

gst-launch-0.10 -e pulsesrc device=source.record ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio.m4a


camera application vs gstreamer:
- audio bitrate - 128kbps vs you can choose
- audio rate - 48000Hz vs 44100Hz
- audio source - source.record vs you can choose (ad 2.)

- both has one channel
- the same codec - nokiaaacenc
- the same container - hantromp4mux



Code:

gst-inspect-0.10 nokiaaacenc
(0): RAW - AAC Raw format (it needs container)
(1): ADTS - Audio Data Transport Stream format (can be streams directly into playable aac file)
(2): ADIF - Audio Data Interchange Format




Here are the samples of clicking noise. I have noticed that when sim card is "active" clicking noise has higher frequency; when the phone is in offline mode this frequency is lower. Audio04 is the sample of this first situation, Audio05 for the second one. Additionally, in this second situation I hear probably more distortions to the recorded sound.

NotMicro 2017-07-03 13:21

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1529753)
You can use different audio source instead of 'source.hw0':

source.voice (hardware dsp)
source.record

Do you know what is the difference in parameters and quality of recorded sound using these sources? And why source.voice has hardware dsp support and others have not?

NotMicro 2017-07-03 13:27

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1528840)
this set gain for it (0-127), here is 60
Code:

amixer -qc0 set PGA 60

Is this a setting for all types of recording source(that is - microphone) ? What is the default value of this parameter? Has N900 option to use AGC in recording? And how to turn it on?

ontime 2017-07-03 17:38

Re: Recording problem using different applications.
 
Quote:

I have noticed that when sim card is "active" clicking noise has higher frequency; when the phone is in offline mode this frequency is lower
If audio04.m4a and audio05.m4a was recorded by build in mic or headset mic? How do you recognize if sim card is active or not? Are you meaning active sim card as gsm online or making call / send / receive sms?

source.voice (hardware dsp)
source.record
Quote:

Do you know what is the difference in parameters and quality of recorded sound using these sources? And why source.voice has hardware dsp support and others have not?
I think source.voice has 8000kHz by default.
source.record has wider range 8000, 11025, 16000, 22050, 44100, 48000 [kHz] or sth like that.

Why don't you check its quality? You can use gstreamer for that. Source.voice is optimized for better understanding human voice through gsm transmision and maybe for some background noise cancellation.

Quote:

Is this a setting for all types of recording source(that is - microphone) ? What is the default value of this parameter?
default is 0, I think. It's for headset mic and fm radio at least.

Quote:

Has N900 option to use AGC in recording? And how to turn it on?
yes, is has
Code:

amixer -qc0 cset name='AGC Switch' on
amixer -qc0 cset name='AGC Switch' off

or you can find it in
Code:

alsamixer -c0
can be changed by 'm' key

NotMicro 2017-07-05 15:35

Re: Recording problem using different applications.
 
Thank you once again for your complete answer. It is really something !!

Quote:

Originally Posted by ontime (Post 1530082)
If audio04.m4a and audio05.m4a was recorded by build in mic or headset mic? How do you recognize if sim card is active or not? Are you meaning active sim card as gsm online or making call / send / receive sms?

It was recorded by build-in mic. Active means gsm online. I didn't test recording during making call yet.

NotMicro 2017-07-05 15:40

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1530082)
Why don't you check its quality? You can use gstreamer for that.

Could you, please, explain how to use gstreamer to test quality of recording. And what quality means - parameters of recordng (for example - sample frequency) or levels, oversteering etc. ?

ontime 2017-07-05 16:39

Re: Recording problem using different applications.
 
Quote:

It was recorded by build-in mic. Active means gsm online. I didn't test recording during making call yet.
It's strange, because none of my N900 doesn't do that clicking noise. Maybe is it some hardware issue? I don't know. You can also ask at freenode irc channel #maemo https://webchat.freenode.net/

Quote:

Could you, please, explain how to use gstreamer to test quality of recording. And what quality means - parameters of recordng (for example - sample frequency) or levels, oversteering etc.?
Let's make two files (record your voice each time). First file will have 8kHz sample frequency and second 44.1kHz. Probably both will have the same depth 12bits or what N900 sound card has.
Code:

gst-launch-0.10 -e pulsesrc device=source.record ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio_source_record.m4a
gst-launch-0.10 -e pulsesrc device=source.voice ! audio/x-raw-float,channels=1 ! audioconvert ! nokiaaacenc bitrate=64000 output-format=0 ! hantromp4mux ! audio/x-m4a ! filesink location=/home/user/MyDocs/audio_source_voice.m4a

I'm sure, you'll immediately notice difference in quality. But if you want measure noise level, you can use audacity for example. It'll give you noise level in dB - one parameter of sound quality.

NotMicro 2017-07-10 12:39

Re: Recording problem using different applications.
 
Quote:

Originally Posted by ontime (Post 1530143)
It's strange, because none of my N900 doesn't do that clicking noise. Maybe is it some hardware issue? I don't know. You can also ask at freenode irc channel #maemo https://webchat.freenode.net/

As I wrote before, there are also other people who have the same problem. I see that you are experienced user of N900, so maybe you know how to test hardware of it without using external service devices. And how to check if my model is OK. I have heard of many N900's that are "refubrished" ones.


All times are GMT. The time now is 06:51.

vBulletin® Version 3.8.8