Code Monkey home page Code Monkey logo

alsasoundmeter's Introduction

Description

A simple Linux sound meter based on ALSA API. Here's the demo on youtube. The noisy sound is generated by a guitar tuner, and as it gets louder, the dB and peak value displayed on the screen gets larger.

Compile

Just run make, it should work (I hope).

Noted

I wrote this program few years ago and I haven't wrote C and ALSA stuff for a while, so I might not able to answer your question, but I'll do my best if you got any! :)

Please visit ALSA project - the C library reference for more information. This code is based on alsa-lib/test/pcm_min.c.

alsasoundmeter's People

Contributors

hamarituc avatar johnliu55tw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

alsasoundmeter's Issues

mention library packages needed

$ make
gcc sound_meter.c -o sound_meter -lm -lasound
sound_meter.c:25:9: fatal error: alsa/asoundlib.h: No such file or directory
   25 | #include<alsa/asoundlib.h>
      |         ^~~~~~~~~~~~~~~~~~
compilation terminated.

transform the code in a stereo meter

Hello Johnliu.
I'm not a C coder, but i tryed to transform your code in a stereo meter to get the dsnoop virtual sound card to monitor recorded/streamed (stereo) signal.

the attached code is a mare duplication of your, but obviusly is segmentating (no compilation error altough). I suppose a stereo signal has a returning sample of twice the data and have to be slitted in lower (L) and upper(sample data), but do not know how to do that.

Attached my modded code, could you help me making your smart code a more flexible vumeter application?

Thanks,
Federico

sound_meter.c.txt

Doesn't compile with gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)

But it compiles just nice with clang version 3.8.0-2ubuntu4, and the executable works smoothly.

The errors that I get if I run make (with gcc) are:

/tmp/ccqMjrgS.o: In function rms': sound_meter.c:(.text+0x7b): undefined reference to sqrt'
/tmp/ccqMjrgS.o: In function main': sound_meter.c:(.text+0x122): undefined reference to snd_pcm_open'
sound_meter.c:(.text+0x135): undefined reference to snd_strerror' sound_meter.c:(.text+0x181): undefined reference to snd_pcm_set_params'
sound_meter.c:(.text+0x198): undefined reference to snd_strerror' sound_meter.c:(.text+0x1f2): undefined reference to snd_pcm_readi'
sound_meter.c:(.text+0x216): undefined reference to snd_pcm_recover' sound_meter.c:(.text+0x22d): undefined reference to snd_strerror'
sound_meter.c:(.text+0x298): undefined reference to `log10'
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target 'sound_meter' failed
make: *** [sound_meter] Error 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.