Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files
To: Maarten Bosmans; General PulseAudio Discussion Subject: Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files 2011/3/21 Vincent Becker vincentx.bec...@intel.com: Hi, I recently created a new PA module (module-log-pcm) which is able to log PCM samples from any source/sink and its corresponding outputs/inputs. For testing audio quality, checking signal processing or verifying the right implementation of a sound device mixed in PA, application fields are many. What is the use case you are specifically interested in? Hi, I just wished to relive the announcement of creating a new module dedicated to log PCM samples. It could be interesting to make it part of Pulseaudio. It can be useful at anytime and provides complementary differences with parec. I know it can sound 'gadget' and not properly useful but for some architectures containing a lot of sinks/sources, it can log actually simultaneous living devices. Wow, at some point it can be worth it! The advantages of this feature are many and if needed, I can provide a fully documented manual for it. Vincent - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files
-Original Message- From: Maarten Bosmans [mailto:mkbosm...@gmail.com] Sent: Wednesday, March 23, 2011 7:44 PM To: General PulseAudio Discussion Cc: Becker, VincentX Subject: Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files 2011/3/21 Vincent Becker vincentx.bec...@intel.com: Hi, I recently created a new PA module (module-log-pcm) which is able to log PCM samples from any source/sink and its corresponding outputs/inputs. For testing audio quality, checking signal processing or verifying the right implementation of a sound device mixed in PA, application fields are many. What is the use case you are specifically interested in? It can just be any use case that is related to audio and Pulseaudio. I am particulary interested to log audio before and after sound algorithms to check that the signal processing has been well applied (or filters). One just needs to give a parameter list depending on what is wished to be logged. During the process, an audio tree, or parts of it, is probed and logged for post-treatment purposes. I'm sorry if I am being stuped here, but wat can the module do that you can't with parec from a monitor source? The module does the exact same thing as parec but parec can just log one device at a time but not the inputs and/or outputs. If you wanted to log the whole set of sinks/sources connected to Pulse, you would need to run as many parec commands as there are devices. Not very practical though. With the module you can specify a list of sinks or sources and choose to log the inputs or outputs, thing that is impossible now with Pulseaudio. Ok that needs a modification in the Pulsecore to probe the chunks when they are peeked or pushed but I don't see any other way. For design needs, sources and sinks are designated by ends and source outputs/sink inputs by ports. Why introduce the new terminology here? I think it is confusing for people that know pulse already. Or is there perhaps some subtle difference between the pulse concept and your designation for it? Just to group sinks and sources under one word, same for inputs/outputs. It does not exist in Pulseaudio, am I right? So it shouldn't confuse anybody, I hope. I am pretty sure that this module can be useful, especially when big sets of sinks/sources are present and someone wants to analyze an audio tree part of these sets during a specific use case. Why not ? May be it will create some needs at least.. Maarten - Intel Corporation SAS (French simplified joint stock company) Registered headquarters: Les Montalets- 2, rue de Paris, 92196 Meudon Cedex, France Registration Number: 302 456 199 R.C.S. NANTERRE Capital: 4,572,000 Euros This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies. ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss
[pulseaudio-discuss] [RFC PATCH] Log PCM samples to files
Hi, I recently created a new PA module (module-log-pcm) which is able to log PCM samples from any source/sink and its corresponding outputs/inputs. For testing audio quality, checking signal processing or verifying the right implementation of a sound device mixed in PA, application fields are many. One just needs to give a parameter list depending on what is wished to be logged. During the process, an audio tree, or parts of it, is probed and logged for post-treatment purposes. For design needs, sources and sinks are designated by ends and source outputs/sink inputs by ports. Module-log-pcm's main characteristics are : - Core principles : given a source or a sink name, a working source output used only for log is created and plugged (to the sink.monitor in case of a sink). PCM samples are handled in the push callback and can be redirected to any log device. For ports (SO/SI), the only information available is the connected sink/source and the index. As a result, hooks in the pulsecore have been necessary to capture PCM chunks, before resampling for sink inputs and after resampling for source outputs. - Choice between a local or remote target : this functionnality uses pa_object object-oriented library. Depending if the log is saved in a wave file or written to any other type of file descriptor (type of target), a serializer implementation does the logging of PCM samples. Each serializer (local-file-serializer or remote-device-serializer) is defined within PA_DEFINE_PUBLIC_CLASS that allows a kind of function polymorphism. Wave files are named per end or port names, e.g. sink_name.wav and for ports, the index is appended to the log file name, e.g. for index 2 : sink_name_2.wav. For local log : libsndfile is used to log in wav files in the same manner as pacat. A directory is specified in parameter, where all the wav files can be stored. For remote log (in opposite to local log..) : a header is attached at the beginning of the log file, containing sample spec informations, signal strength (volume ?), source/sink name... - Log of sources/sinks with or without their outputs/inputs : All or none of the ports can be logged by means of an option specified at the module loading : trace_ports=yes/no . - Management of put, move, unlink events : If an end is declared to be logged, it will be monitored whatever its creation comes after or before the loading of module-log-pcm, and for move events, a new log file will be created after each move to help distinguish the samples. The move prefix along with a number is appended to the log file name. Also when a device is unlinked, its corresponding log file will be closed. - Support of most of the data sample formats : Data formats like PA_SAMPLE_S24_32NE can also be logged, but a realignment of the 24 bits on 32 bits is necessary to ensure correct audio restitution in a wave file. These are examples of logging different sinks/sources to a target : Log specified sinks and one source with their ports, in wav files to directory wav_log_files : Load module-log-pcm sinks_to_log=alsa_output.intel_mfld_msic_audio.earphone,sink.music sources_to_log=source.record trace_ports=yes log_target=/home/vincent/wav_log_files/ We shall get wave files like these : alsa_output.intel_mfld_msic_audio.earphone.wav alsa_output.intel_mfld_msic_audio.earphone_0.wav sink.music.wav sink_music_1.wav source.record.wav source_record_2.wav Log specified sinks and sources (note the .monitor is in the list of sources) without their ports to a remote device : Load module-log-pcm sinks_to_log=alsa_output.intel_mfld_msic_audio.earphone sources_to_log=sink.hsandihf.monitor,source.record trace_ports=no log_target=/dev/remote_snd The development might look a bit ackward and certainly still needs modifications but it macan be seen as the first stone of experimental logging.. Please feel free to comment. Thanks, Vincent Vincent Becker (1): Log module: new module to log PCM chunks. src/Makefile.am| 11 +- src/modules/log/local-file-serializer.c| 181 + src/modules/log/local-file-serializer.h| 47 ++ src/modules/log/log-pcm-serializer.c | 50 ++ src/modules/log/log-pcm-serializer.h | 52 ++ src/modules/log/module-log-pcm.c | 1113 src/modules/log/pcm-logger-data.h | 57 ++ src/modules/log/remote-device-serializer.c | 140 src/modules/log/remote-device-serializer.h | 48 ++ src/pulsecore/core.h |2 + src/pulsecore/sink-input.c | 18 + src/pulsecore/sink-input.h |5 + src/pulsecore/source-output.c | 27 +- src/pulsecore/source-output.h |6 + 14 files changed, 1753 insertions(+), 4 deletions(-) create mode 100755 src/modules/log/local-file-serializer.c create mode 100755 src/modules/log/local-file-serializer.h create mode 100755
Re: [pulseaudio-discuss] [RFC PATCH] Log PCM samples to files
2011/3/21 Vincent Becker vincentx.bec...@intel.com: Hi, I recently created a new PA module (module-log-pcm) which is able to log PCM samples from any source/sink and its corresponding outputs/inputs. For testing audio quality, checking signal processing or verifying the right implementation of a sound device mixed in PA, application fields are many. What is the use case you are specifically interested in? One just needs to give a parameter list depending on what is wished to be logged. During the process, an audio tree, or parts of it, is probed and logged for post-treatment purposes. I'm sorry if I am being stuped here, but wat can the module do that you can't with parec from a monitor source? For design needs, sources and sinks are designated by ends and source outputs/sink inputs by ports. Why introduce the new terminology here? I think it is confusing for people that know pulse already. Or is there perhaps some subtle difference between the pulse concept and your designation for it? Maarten ___ pulseaudio-discuss mailing list pulseaudio-discuss@mail.0pointer.de https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss