# AudioData Conversion to Int32

**URL:** <https://forum.juce.com/t/audiodata-conversion-to-int32/55367>\
**Category:** General JUCE discussion\
**Created:** [March 13, 2023, 10:45pm UTC](https://forum.juce.com/t/audiodata-conversion-to-int32/55367 "2023-03-13T22:45:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaxWalley](https://avatars.discourse-cdn.com/v4/letter/m/ee7513/32.png) [@MaxWalley](https://forum.juce.com/u/MaxWalley)\
**Post date:** [March 13, 2023, 10:45pm UTC](https://forum.juce.com/t/audiodata-conversion-to-int32/55367/1 "2023-03-13T22:45:17Z")

</div>

I am trying to interleave samples while simultaneously convert them from float to signed 32 bit integers. I have been trying to do this with the AudioData class. Here is a minimal example:

```auto
using SrcFormat = juce::AudioData::Format<juce::AudioData::Float32, juce::AudioData::NativeEndian>;
using DstFormat = juce::AudioData::Format<juce::AudioData::Int32, juce::AudioData::NativeEndian>;
    
    Test()
    {
        const int numChannels = 5;
        const int numSamples = 1024;
        
        juce::AudioBuffer<float> src(numChannels, numSamples);
        std::vector<int32_t> dst(numChannels * numSamples, 0.0f);
        
        juce::AudioData::interleaveSamples(juce::AudioData::NonInterleavedSource<SrcFormat>{src.getArrayOfReadPointers(), numChannels}, juce::AudioData::InterleavedDest<DstFormat>{dst.data(), numChannels}, 1024);
    }

```

The interleave function expects the destination vector to be of type unsigned 32 bit int however this is not what I specified in the DstFormat. Have I got something wrong or do I need to split up my interleaving and sample conversion?
