bugGNU Octave - Bugs: bug #62538, [octave forge] (arduino) playTone...

 
 

bug #62538: [octave forge] (arduino) playTone function does not play the correct frequency

Submitter:  Koichi Hamada <hamadak2000>
Submitted:  Sun 29 May 2022 01:22:24 AM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  lostbard
Originator Name:  Koichi Hamada Open/Closed:  * Closed
Release:  * 6.4.0 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 13 Jul 2022 03:33:03 PM UTC, comment #2: 

New release 0.9.1 made with the added change - closing

John Donoghue <lostbard>
Group Member
Sun 29 May 2022 09:44:19 PM UTC, comment #1: 

Thanks for the bug notification - corrected in https://sourceforge.net/p/octave/arduino/ci/4d2049efa3c18e05bd66553feb88c5efdc9ecc69/ and will appear in the next release

John Donoghue <lostbard>
Group Member
Sun 29 May 2022 01:22:24 AM UTC, original submission:  

I found a computational bug in "playTone.m".
The bit-shift operation is incorrect at Line 64 in file "playTone.m".

63: freq = uint16(freq);
64: freqh = bitand(freq/256, hex2dec('FF'));


The bitshift() function shold be used for bit-shift operation.
This is because division over uint16 types does not return the value we expect.
For example, Octave returns "2" as a result of "uint16(400)/256".

So the code "freq/256" at Line 64 should be replace by "bitshift(freq, -8)". Line 68 needs the same modification.

Koichi Hamada <hamadak2000>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by lostbard (Posted a comment)
  • -email is unavailable- added by hamadak2000 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-07-13 lostbard StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2022-05-29 lostbard StatusNone Ready For Test
        Assigned toNone lostbard

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code