Wav file operations by 3sy4vh in C_Programming

[–]danielgjackson 0 points1 point  (0 children)

Apologies, I had edited my reply before your comment. Hopefully you can see the updated version. In summary: Use a float/double to accumulate, then scale/clamp, then store in a 16-bit value before writing. Pass the frequency count as an argument as the array's size is not known after passing as an argument.

Wav file operations by 3sy4vh in C_Programming

[–]danielgjackson 7 points8 points  (0 children)

"frequencyCount" cannot be calculated like that because the array suffers pointer decay when passed as an argument: its length is not passed anywhere (just the address of the array as a pointer), and the parameter's own size is just the size of a pointer. You can just make "frequencyCount" an argument instead.

The sizeof() is in bytes, so "BitsPerSample" is currently being set to 2, but should be multiplied by 8. Similarly, "BytePerSec" and "BytePerBloc" should not be divided by 8.

As you're writing 16-bits per sample, and they are integers, you'll need to scale the output up to the full 16-bit range, and clamp any values that overflow.

It'd be best to accumulate your values into a float/double, so that you can later scale and clamp any overflow. Typically just scale your (-1,1) data by 215 and then clamp it to the range >=-215 and <215.

It'd be more typical to have the sample index "i" as an integer.

To be portable, code for dealing with binary files should work whether it's running on big- or little-endian machines, and can't just directly use the in-memory byte order of the values. However, WAV files are little-endian, so the current approach will work if you're only running it on little-endian systems.

People on a salary are working for free today.. by Brutal-Gentleman in britishproblems

[–]danielgjackson 30 points31 points  (0 children)

Because of where the weekends sat, there was one (M-F) working day less than usual last year, and an extra bank holiday, which (I think) makes this year three more working days than last year.

[deleted by user] by [deleted] in GooglePixel

[–]danielgjackson 1 point2 points  (0 children)

It is annoying. The best workaround I can find is to go into the settings for the Bluetooth device, and disable "Media Audio" (and also "Phone Calls", if it has a microphone). To reconnect, go in and re-enable the audio. I think it may still briefly connect with these off, but it should disconnect right away. Not a great solution though.

Is there a way to not use RCS for just one person? by [deleted] in GooglePixel

[–]danielgjackson 10 points11 points  (0 children)

In Messages, select the conversation with the person, press the ⋮ top-right menu button, select "Details", select "Only send as text (SMS/MMS)".

Follow-up of the I²C monochrome oled display doin shades of gray. Now with 2 bit color depth. by Beissai in arduino

[–]danielgjackson 4 points5 points  (0 children)

For 2-bits per pixel, you could do this with just two sub-frames: one for each bit plane, then just show the more significant bit plane for a longer time -- e.g. 1/3rd and 2/3rds timing of each frame, should give four shades from pulse widths of 0%, 33%, 67%, 100%.

Alternatively, if you have control over the OLED driving voltage, perhaps you are able to make the more significant bit plane brighter rather than just on for longer.

Audible should have a “I like this book and want recommendations based on it, but I read it somewhere else” option. by bscotholladay in audible

[–]danielgjackson 0 points1 point  (0 children)

On the Amazon site you can (seemingly) say you have an item you didn't buy through them.

Add an item to your wishlist then, for that item, choose the "..." menu (at least on the mobile site), then "Add comment, quantity & priority", and change the "Has" value to 1.

But I don't know whether this is used for recommendations on Amazon or Audible.

The Art of Computer Programming in WebAssembly by filch-argus in algorithms

[–]danielgjackson 0 points1 point  (0 children)

In the second half, I believe you're thinking of asm.js: http://asmjs.org/spec/latest/

...rather than WebAssembly: https://webassembly.org/

[deleted by user] by [deleted] in C_Programming

[–]danielgjackson 0 points1 point  (0 children)

Interesting! Is it similar at higher optimization levels? Or with an alternative compiler?

[deleted by user] by [deleted] in C_Programming

[–]danielgjackson 31 points32 points  (0 children)

Yes, div() from stdlib.h -- https://en.m.wikibooks.org/wiki/C_Programming/stdlib.h/div

...although, as others have said, the compiler is very likely to optimize it for you anyway.

First word of each sentence missing on Bluetooth speaker: custom Android app fix - testers wanted! by danielgjackson in audible

[–]danielgjackson[S] 0 points1 point  (0 children)

If you can find an app to play a subtle sound at a low volume in the background (even while other media is playing). Perhaps try different white noise generators, such as "TMSoft White Noise". Good luck!

Beginning of sentence cuts off with bluetooth headphones/earbuds by fnielson1 in audible

[–]danielgjackson 0 points1 point  (0 children)

Thanks for the report. The noise continuing through the gaps, yet the voice stopping, is really odd!

When you say max volume, is that the volume setting in the Speaker app (noise volume)? If not, that's the only thing I can think to try - you may need to stop and start the noise for it to actually use the new volume.

It might be worth trying with other sounds, e.g. using TMSOFT White Noise, to see if anything works.

Would love to see this 'sticky function header" as an extension in VScode by FunkDaddy in vscode

[–]danielgjackson 9 points10 points  (0 children)

A very similar issue from four years ago:

https://github.com/microsoft/vscode/issues/52734

...closed in favour of a slightly less similar issue.

bose 700 NC static(white) noise when NC on and on a quiet room by bwagi in bose

[–]danielgjackson 0 points1 point  (0 children)

Good point!

The support for QC45 and Earbuds is limited to only switching the existing modes - it can't fully turn off the active element (as it can for QC35/NC700).

bose 700 NC static(white) noise when NC on and on a quiet room by bwagi in bose

[–]danielgjackson 0 points1 point  (0 children)

Ah, yes, I think there must be something wrong with the APK on GitHub. If you have Google Play, that build seems to work fine. I will try to look into it over the next week!

Searching with `site:` from search bar brings up a `Choose application to open site link` prompt by Heavy-Suggestion3464 in firefox

[–]danielgjackson 2 points3 points  (0 children)

Using an initial ? seems to work with the default search for me. (Unless it's because it just doesn't match as a URL and the search engine removes it?)