beep | little package that brings sound | Audio Utils library
kandi X-RAY | beep Summary
kandi X-RAY | beep Summary
A little package that brings sound to any Go application. Suitable for playback and audio-processing.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of beep
beep Key Features
beep Examples and Code Snippets
Community Discussions
Trending Discussions on beep
QUESTION
How to play sounds at different tones in C without using any external library? I know there are dozens of sound libraries in C that allows you to play sound but what I want to know is how does that work behind? How do you tell the computer to play a certain note at a certain tone/frequency?
I know it's possible on windows using the sound()
function but I can't find any documentation talking about Linux, all that I found is the beep()
function (or write(1, "\a", 1)
) that outputs the default terminal beep but I can't figure out how to play different sounds.
ANSWER
Answered 2022-Mar-12 at 00:22The Linux kernel native audio API is ALSA (Advanced Linux Sound Architecture).
Example of raw audio playback with ALSA:
https://gist.github.com/ghedo/963382/815c98d1ba0eda1b486eb9d80d9a91a81d995283
However, ALSA is a low-level API that is not recommended to be used directly by higher-level applications.
A modern system audio API for GNU/Linux would be either PulseAudio (the current default on Ubuntu), or the newer and arguably better PipeWire (the default on Fedora).
Example of raw audio playback with PipeWire that generates audio "from scratch":
https://docs.pipewire.org/page_tutorial4.html
How do you tell the computer to play a certain note at a certain tone/frequency?
Sound is a mechanical vibration that propagates through the air (or another medium). It can be represented digitally as a sequence of numerical values representing air pressure at a given sampling rate. To play a given tone/frequency, generate a sine wave of that frequency (at the playback sampling rate) and use the sound API of your choice to play it.
See the PipeWire tutorial above for an example generating a 440Hz tone.
About PulseAudio/PipeWire:
These libraries are typically part of the OS and exposed as system APIs (so they are not "external libraries" if that means some library to ship with your program or to ask users to install), and they should be used by applications to play audio.
Behind the scene, these libraries handle audio routing, mixing, echo-canceling, recording, and playback to the kernel through ALSA (or using Bluetooth, etc). Everything that users and developers expect from the system audio layer.
Until recently, PulseAudio was the de-facto universal desktop system audio API, and many apps still use the PulseAudio API to play audio on GNU/Linux.
PipeWire includes compatibility with PulseAudio, so that apps using the PulseAudio API will keep working in the foreseeable future.
Example of raw audio playback with PulseAudio:
https://freedesktop.org/software/pulseaudio/doxygen/pacat-simple_8c-example.html
QUESTION
I'm trying to write a program in TASM that plays music notes. I couldn't find any documentation online and the closest thing I found was this stackoverflow question, which is able to produce a "beep" sound.
What I don't know is:
How this code works
What the sound mapping is
How I can play specific notes (do re mi...)
ANSWER
Answered 2022-Feb-23 at 15:58Playing a single tone with PC speaker may use method mentioned in the quoted question. It uses square-wave generator from system timer, activated by setting mode of operation 0xB6 to I/O port 0x43. See Timer Ports. The value 182=0xB6=0y10110110 written to port 0x43 specifies
- selection of timer counter Nr.2 (bits 6-7)
- endianess: LowByte first, HighByte second (bits 4-5)
- mode 3: square-ware generation (bits 1-3)
- format 0: binary mode (bit 0).
Then you are expected to specify the required frequency
with
OUT 0x42,LowByte
andOUT 0x42,HighByte
. This 16bit binary integer number actually specifies period of the square wave, i.e. the number of ticks that must elapse to flip the wave from 0 to 1 and vice versa.
When you have programmed the frequency, ask the Programmable Peripheral Interface to connect speaker to the square-wave generator. This is done by setting the two least significat bits if PPI port 0x61, see PPI Ports.
QUESTION
I have more than 200 workbooks in an Folder, and i deletes the empty rows by giving an Range in the code that is Set rng = sht.Range("C3:C50000")
.
If Column C
any cell is empty then delete entire Row. Day by day data is enhancing and below code took nearly half hour to complete the processing. That time limit is also increasing with the data.
I am looking for a way to to do this in couple of minutes or in less time. I hope to get some help.
...ANSWER
Answered 2021-Oct-07 at 16:22Try this for quicker row deletion:
QUESTION
I'm not sure I can include reproducible code on this, given there's 4,000 lines of code and that may be part of the problem, but let me try to explain my question the best I can:
I love using beepr
to play an audible sound when a bunch of code is done processing. If my computer is taking a while to run it, I'll go look at a different screen or do something else in the room when its thinking.
I have a large .rmd file. Its 4187 lines long and beep()
is on line 4185. I made sure it was nowhere else in the document using ctrl+f. When I "run all", the beep goes off when I'm about this far through the document:
And then it'll continue thinking for another few minutes before its done. This defeats the entire purpose of beepr()
.
So I guess my question is: is this a known problem? Is there anything particular to a .rmd document that does this? Any known fixes?
...ANSWER
Answered 2022-Mar-02 at 16:13This function takes an input file, extracts the R code in it according to a list of patterns, evaluates the code and writes the output in another file.
So the thing you are observing is due to the fact all R code in the .rmd gets evaluated before the whole process is finished. The sound plays when the beepr line is executed, since this will happen (rcode chunk) before the document is processed by pandoc (or similar) i would just advise you to put the beeper outside of the .rmd itself to trigger it after the process finished. write a 3 line r sript:
QUESTION
In a 664 bit app, If I compare a floating point constant to a value obtained from StrToFloat() for the same "value" I get a different results. For example:
...ANSWER
Answered 2022-Feb-22 at 21:33Float literals in Delphi are Extended by default. In 64 bits, that shouldn't make any difference, but in 32 bits it does. My guess is that the parser still internally represents float literals as a 10 byte float(extended), and then the 64 bits compiler "round it down" to 8 bytes(double) when compiling.
If my hypothesis is right, there might be nothing that can be done to circumvent that.
EDIT
Delphi does the following conversion
- Double(3FE56C4FB47339B3) converts to Extended(3FFEAB627DA399CD9800)
- Double(3FE56C4FB47339B4) converts to Extended(3FFEAB627DA399CDA000)
- 0.6694716 is Extended(3FFEAB627DA399CD9C00)
QUESTION
For my physics Research Practicum I'm analyzing the resonance frequency of a wine glass, which involves importing an audio file and taking its Fourier transform (using scipy.fftpack). So everything is going well, but when I plot the Fourier transform, I get two lines: one is the plot you would expect, but the other one is a horizontal line (see picture). I've looked into the variables I'm plotting but nothing seems out of the ordinary there.
Here's the code (you'll need this .wav file (watch out for your ears, headphone users!)):
...ANSWER
Answered 2022-Feb-27 at 14:04This is how the plot of Fourier_x
alone looks like:
QUESTION
I want to play some audio with volume lvl adjusted to ear aka. "phone call mode". For this purpose, I'm using well-known and commonly advised
...ANSWER
Answered 2022-Feb-11 at 19:31found some answers to my own question, sharing with community
6-sec auto-switch mode is a new feature in Android 12, which works only if (mode == AudioSystem.MODE_IN_COMMUNICATION)
(check out flow related to MSG_CHECK_MODE_FOR_UID
flag). This should help for MODE_IN_COMMUNICATION
set to AudioManager
and left after app exit, this was messing with global/system-level audio routing. There is also a brand new AudioManager.OnModeChangedListener
called when mode is (auto-)changing
and setSpeakerphoneOn
turns out to be deprecated, even if this isn't marked in doc... we have new method setCommunicationDevice(AudioDeviceInfo)
and in its description we have info about startBluetoothSco()
, stopBluetoothSco()
and setSpeakerphoneOn(boolean)
deprecation. I'm using all three methods and now on Android 12 I'm iterating through getAvailableCommunicationDevices()
, comparing type of every item and if desired type found I'm calling setCommunicationDevice(targetAudioDeviceInfo)
. I'm NOT switching audio mode at all now, staying on MODE_NORMAL
. All my streams are AudioManager.STREAM_VOICE_CALL
type (where applicable)
for built-in earpiece audio playback aka. "ear-friendly mode" we were using
QUESTION
So I wanted to build a metronome and decided to use pyaudio. I know there are other ways but I want to make something else later with that.
Thats my Code so far:
...ANSWER
Answered 2022-Feb-08 at 18:16You want the play_audio function to be called every 60/bpm seconds, but the function call itself takes time: you need to read the file, open the stream, play the file (who knows how long it is) and close the stream. So that adds to the time from one click to the next.
To fix this problem, you could try subtracting the time it takes to run the play_audio function from the time you sleep. You could also experiment with running play_audio on a separate thread.
QUESTION
I have a code I was using inside Google GAS but I had to refactore it a bit to use it outside and I'm having trouble with a for loop I had to form an array. I'll make the code reproducible with read API Keys in a dev envirorment.
...ANSWER
Answered 2022-Feb-01 at 19:09So, I solved the issue with the async / promise.
QUESTION
For a while, I am troubled with this issue.
Using a snippet of C++ code, which I found here, and in my opinion should do a good job actually sending exact amount of data, I guess the problem is in the Java code or something unknown.
Also, when sending simple "Hello World"
data, transfer is done correctly.
I would be grateful is somebody could solve it, or give a valuable advice. I am running Windows 10 with jdk1.8.0_221 and Visual Studio 2022.
I understand there could be a need to send filesize
as a string and aknowledge flag in return in future, but for simplicity the C++ client is sending only one file with known amount of data.
Here is the Java side:
...ANSWER
Answered 2022-Jan-27 at 21:47The C++ code is sending the file size before sending the file data (good), but is not doing adequate error handling (bad), and it is NOT sending the file size in an platform-agnostic format (bad).
Not that it matters, because the Java code shown is NOT even attempting to read the file size before reading the file data (very bad), nor is it paying attention to the return value of in.read()
to know how many bytes are actually received. But even if it were, the C++ code is sending the size as an 8-byte integer (needed for large files > 2GB), but the Java code is using a 4-byte integer instead (bad). The C++ is also using a 4-byte integer for bytes_sent
in SendFile()
.
Try something more like this:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install beep
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page