[PD] soundtouch~ status quo (was: soundtouch~, slicerec/sliceplay for 64 bit windows?)

katja katjavetter at gmail.com
Wed Oct 30 10:09:44 CET 2019


On 10/30/19, Christof Ressi <christof.ressi at gmx.at> wrote:
> The problem is actually in the code:
>
> (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
>
> This line probably tries to align memory on the stack to 16 bytes boundaries
> for SSE code. The problem is that "ulong" is a typedef for "unsigned long".
> The code assumes that "long" always has the size of a pointer (4 bytes on 32
> bit and 8 bytes on 64 bit), but on Windows it is always 4 bytes, so on 64
> bit you get a size mismatch.

Christof thanks for your analysis and explanation.

To be clear about the current state of soundtouch~: it is a (partial)
port for Pd of Olli Parviainen's SoundTouch library. Olli's project is
probably up to date with the latest platforms but the port was derived
(by me) from an earlier version back in 2011. Ideally soundtouch~ for
pd should be realigned with latest SoundTouch from Olli, and also get
a new build system. Maybe not horribly much work but frankly it can't
be high my todo list. If someone is interested to adopt this project,
take a look at Olli's SoundTouch project and my page describing the
port for pd:

www.surina.net/soundtouch/
www.katjaas.nl/pitchshift/soundtouch~.html

(And to avoid confusion about the other classes mentioned in subject
title: slicerec~/sliceplay will be soon updated by me in the context
of Slice//Jockey).

Katja


>
> A quick and dirty fix: find the relevant "#define" or "typedef" for "ulong"
> and set it to "unsigned long long" for 64 bit Windows:
>
> #ifdef _WIN64
> #define ulong unsigned long long
> #else
> #define ulong unsigned long
> #endif
>
> Please make a bug report to the upstream author.
>
> Christof
> Gesendet: Mittwoch, 30. Oktober 2019 um 00:46 Uhr
> Von: "pat pagano" <shreeswifty at gmail.com>
> An: pd-list at iem.at
> Betreff: Re: [PD] soundtouch~, slicerec/sliceplay for 64 bit windows?
>
> I know that i am flailing with windows makefiles but i was hopeful that from
> trying to compile such an essential external for a few patches i've written
> with it I would learn compiling externals more clearly for pd and of course
> windows
>
> here's what i get:
>
> g++ -m64 -msse -DNT -DPD_LONGINTTYPE=__int64 -DMSW -Wall -Wextra -Wshadow
> -Wint-to-pointer-cast -Winline -Wstrict-aliasing -O3 -ffast-math
> -funroll-loops -fomit-frame-pointer -march=core2 -msse -msse2 -msse3
> -mfpmath=sse -I ./include -c *.cpp
> FIFOSampleBuffer.cpp: In member function 'void
> soundtouch::FIFOSampleBuffer::ensureCapacity(uint)':
> FIFOSampleBuffer.cpp:181:39: error: cast from 'soundtouch::SAMPLETYPE*' {aka
> 'float*'} to 'ulong' {aka 'long unsigned int'} loses precision
> [-fpermissive]
>          temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
>                                        ^~~~~~~~~~~~~
> FIFOSampleBuffer.cpp:181:71: warning: cast to pointer from integer of
> different size [-Wint-to-pointer-cast]
>          temp = (SAMPLETYPE *)(((ulong)tempUnaligned + 15) & (ulong)-16);
>                                                                        ^
> FIRFilter.cpp: In static member function 'static void*
> soundtouch::FIRFilter::operator new(size_t)':
> FIRFilter.cpp:222:39: warning: unused parameter 's' [-Wunused-parameter]
>  void * FIRFilter::operator new(size_t s)
>                                 ~~~~~~~^
> RateTransposer.cpp: In static member function 'static void*
> soundtouch::RateTransposer::operator new(size_t)':
> RateTransposer.cpp:109:44: warning: unused parameter 's'
> [-Wunused-parameter]
>  void * RateTransposer::operator new(size_t s)
>                                      ~~~~~~~^
> soundtouch~.cpp: In function 't_int* soundtouch_perform(t_int*)':
> soundtouch~.cpp:91:39: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_soundtouch *x = (t_soundtouch *)w[1];        // pointer to object
> (struct instance)
>                                        ^
> soundtouch~.cpp:92:43: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_sample *signalvectorIn = (t_sample*)w[2];       // pointer to input
> signal vector
>                                            ^
> soundtouch~.cpp:93:44: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_sample *signalvectorOut = (t_sample*)w[3];       // pointer to output
> signal vector
>                                             ^
> soundtouch~.cpp: In function 't_int* soundtouch_perform2(t_int*)':
> soundtouch~.cpp:115:39: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_soundtouch *x = (t_soundtouch *)w[1];        // pointer to object
> (struct instance)
>                                        ^
> soundtouch~.cpp:116:47: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_sample *signalvectorInLeft = (t_sample*)w[2];      // pointer to input
> signal vector
>                                                ^
> soundtouch~.cpp:117:48: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_sample *signalvectorInRight = (t_sample*)w[3];      // pointer to input
> signal vector
>                                                 ^
> soundtouch~.cpp:118:48: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_sample *signalvectorOutLeft = (t_sample*)w[4];      // pointer to output
> signal vector
>                                                 ^
> soundtouch~.cpp:119:49: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>   t_sample *signalvectorOutRight = (t_sample*)w[5];      // pointer to
> output signal vector
>                                                  ^
> soundtouch~.cpp: In function 'void soundtouch_tilde_setup()':
> soundtouch~.cpp:312:67: warning: cast between incompatible function types
> from 'void* (*)(t_floatarg, t_floatarg)' {aka 'void* (*)(float, float)'} to
> 't_newmethod' {aka 'void* (*)()'} [-Wcast-function-type]
>   soundtouch_class = class_new(gensym("soundtouch~"),
> (t_newmethod)soundtouch_new,
>
>  ^~~~~~~~~~~~~~
> sse_optimized.cpp: In member function 'virtual double
> soundtouch::TDStretchSSE::calcCrossCorrStereo(const float*, const float*)
> const':
> sse_optimized.cpp:96:17: error: cast from 'const float*' to 'ulong' {aka
> 'long unsigned int'} loses precision [-fpermissive]
>      if (((ulong)pV1) & 15) return -1e50;    // skip unaligned locations
>                  ^~~
> sse_optimized.cpp: In member function 'virtual void
> soundtouch::FIRFilterSSE::setCoefficients(const float*, uint, uint)':
> sse_optimized.cpp:288:51: error: cast from 'float*' to 'long unsigned int'
> loses precision [-fpermissive]
>      filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15)
> & (ulong)-16);
>                                                    ^~~~~~~~~~~~~~~~~~~
> sse_optimized.cpp:288:89: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>      filterCoeffsAlign = (float *)(((unsigned long)filterCoeffsUnalign + 15)
> & (ulong)-16);
>
>              ^
> In file included from ./include/FIFOSamplePipe.h:51,
>                  from RateTransposer.h:50,
>                  from TDStretch.h:49,
>                  from sse_optimized.cpp:69:
> sse_optimized.cpp: In member function 'virtual uint
> soundtouch::FIRFilterSSE::evaluateFilterStereo(float*, const float*, uint)
> const':
> sse_optimized.cpp:316:20: error: cast from 'float*' to 'ulong' {aka 'long
> unsigned int'} loses precision [-fpermissive]
>      assert(((ulong)filterCoeffsAlign) % 16 == 0);
>                     ^~~~~~~~~~~~~~~~~
> TDStretch.cpp: In member function 'void
> soundtouch::TDStretch::acceptNewOverlapLength(int)':
> TDStretch.cpp:724:49: error: cast from 'soundtouch::SAMPLETYPE*' {aka
> 'float*'} to 'ulong' {aka 'long unsigned int'} loses precision
> [-fpermissive]
>          pRefMidBuffer = (SAMPLETYPE *)((((ulong)pRefMidBufferUnaligned) +
> 15) & (ulong)-16);
>                                                  ^~~~~~~~~~~~~~~~~~~~~~
> TDStretch.cpp:724:91: warning: cast to pointer from integer of different
> size [-Wint-to-pointer-cast]
>          pRefMidBuffer = (SAMPLETYPE *)((((ulong)pRefMidBufferUnaligned) +
> 15) & (ulong)-16);
>
>                ^
> TDStretch.cpp: In static member function 'static void*
> soundtouch::TDStretch::operator new(size_t)':
> TDStretch.cpp:731:39: warning: unused parameter 's' [-Wunused-parameter]
>  void * TDStretch::operator new(size_t s)
>                                 ~~~~~~~^
>
> On Tue, Oct 29, 2019 at 1:51 AM IOhannes m zmölnig <zmoelnig at iem.at> wrote:
>>
>> On 10/29/19 5:49 AM, pat pagano wrote:
>> > I tired compiling them myself but i keep getting errors so i thought i
>>
>> it seems you have forgotten to attach the errors you get.
>>
>> gfamrds
>> IOhannes
>>
>> _______________________________________________
>> Pd-list at lists.iem.at mailing list
>> UNSUBSCRIBE and account-management ->
>> https://lists.puredata.info/listinfo/pd-list
>
>
>
> --
> Patrick Pagano  B.S, M.F.A
> Assistant Professor, Interactive Media & Education
> Audio Projection & Performance Design
> Howard Community College
> Columbia, Maryland USA
> http://shreeswifty.github.io
> (352)226-2016
>
>
> _______________________________________________ Pd-list at lists.iem.at mailing
> list UNSUBSCRIBE and account-management ->
> https://lists.puredata.info/listinfo/pd-list





More information about the Pd-list mailing list